home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
qbasicpg.zip
/
GETLEFT.BAS
< prev
next >
Wrap
BASIC Source File
|
1989-08-31
|
692b
|
23 lines
' GETLEFT.BAS
' This program demonstrates the LEFT$ function.
CLS
alphabet$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ' declare test string
PRINT "How many characters (from left to right) in the following"
PRINT "string would you like to display?"
PRINT
PRINT alphabet$ ' display test string
PRINT
' get from user number of leftmost characters to be displayed
DO ' loop until number is in proper range (1 through 26)
INPUT " Number (1-26): ", leftNum%
LOOP WHILE (leftNum% < 1) OR (leftNum% > 26)
PRINT
leftChar$ = LEFT$(alphabet$, leftNum%) ' display characters
PRINT "You specified"; LEN(leftChar$); "characters: "; leftChar$